#//////////////////////////////////////////////////////////////////////////
#
# Filename:	Makefile 
# Purpose:	This is the makefile for GutenMark.  It will probably
#		work only with GNU make, and as far as compilers are 
#		concerned, is intended to be used with
#		GNU gcc on *NIX or on mingw32 on Win32.
# Mods:		09/01/01 RSB	Began.
#		09/03/01 RSB	Added AutoMarkWin
#		11/02/01 RSB	Name changed from AutoMark to 
#				GutenMark, and GPL status clarified.
#				gcc-compilation produces two 
#				identical files, GutenMark and 
#				GutenMark.exe.  This is a courtesy
#				thing for compiling with mingw32
#				in Win32.
#		11/22/01 RSB	Added MatchWordlists.  Also, reorganized
#				a lot, to use a single list of source files.
#				Added libz.  Borland compiler probably
#				doesn't work any longer.
#		11/28/01 RSB	Simplified somewhat.
#		11/29/01 RSB	Added regression test.
#		12/01/01 RSB	Final fixups for 12/01/01 release.
#		12/28/01 RSB	Added -funsigned_char to the compiler options.
#		01/21/04 RSB	Now automatically builds GutenUtilities.
#				Also, if mingw32 is installed (on Linux)
#				always tries to build Win32 versions in 
#				addition to the Linux versions ... but doesn't
#				abort on failure.
#		02/21/04 RSB	A "make clean" in Linux now removes GutenMark.exe.
#
#  Copyright 2001,2004 Ronald S. Burkey <info@sandroid.org>
#
#  This file is part of GutenMark.
#
#  GutenMark is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  GutenMark is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with GutenMark; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#//////////////////////////////////////////////////////////////////////////

SOURCES := $(wildcard *.c) $(wildcard libGutenSpell/*.c)

# For generic *nix.  If the cc command isn't gcc, this might not work, 
# and I guess you'll want to substitute "gcc" for "cc".  The reason it's 
# set to "cc" rather than directly to "gcc" is for the benefit of MacOS-X. 
GutenMark: Utilities GutenMarkX.exe $(SOURCES) AutoMark.h
	cc -O3 -Wall -funsigned-char \
		-o GutenMark $(SOURCES) -lz
	./GutenMark bldhb10.txt bldhb10.html
	-diff bldhb10.html bldhb10.txt.html
	
Utilities:
	${MAKE} -C GutenUtilities

# Builds a Win32 version of GutenMark, using mingw32 as installed on a Linux
# computer.  I've had to use a wrong target name to keep the rule from conflicting
# with a similar rule below (for ACTUALLY using mingw32 on Windows).  Therefore,
# this will attempt to build every time, whether or not it's up to date.
GutenMarkX.exe: $(SOURCES) AutoMark.h
	-/usr/local/cross-tools/bin/i386-mingw32msvc-gcc -O3 -Wall -funsigned-char \
		-I./zlib_w32 -o GutenMark.exe $(SOURCES) -L./zlib_w32 -lz

debug: $(SOURCES) AutoMark.h
	cc -g -O0 -Wall -funsigned-char -DDEBUGGING \
		-o GutenMark $(SOURCES) -lz
	./GutenMark bldhb10.txt bldhb10.html
	-diff bldhb10.html bldhb10.txt.html

# For Win32 with mingw32.	
GutenMark.exe: $(SOURCES) AutoMark.h
	gcc -O3 -Wall -funsigned-char -I. -I.. -Izlib_w32 -Lzlib_w32 \
		-o GutenMark.exe $(SOURCES) -lz
	GutenMark bldhb10.txt bldhb10.html
	-fc bldhb10.html bldhb10.txt.html
	
clean:
	-rm GutenMark GutenMark.exe
	-erase GutenMark.exe
	${MAKE} -C GutenUtilities clean
	
	

